﻿using AutoMapper.Internal.Mappers;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using System.Threading.Tasks;
using System;
using test.demo.Model.WM仓储管理;
using wangyaxin.Jiangzhenying.ReturnOrders.Dto;
using wangyaxin.Jiangzhenying.UnitInfos.Dto;
using wangyaxin.Wang.Dto;
using Volo.Abp;
using wangyaxin.Jiangzhenying;

namespace wangyaxin.Web.Jiangzhenying
{
    public class ReturnOrderController : Controller
    {
        private readonly ReturnOrderService _service;
        public ReturnOrderController(ReturnOrderService service)
        {
            _service = service;
        }

        public IActionResult ShowReturnOrderList()
        {
            return View();
        }

        public IActionResult AddReturnOrderView()
        {
            return View();
        }

        public IActionResult UpdateReturnOrderView()
        {
            return View();
        }

        /// <summary>
        /// 添加退回订单
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult AddReturnOrders(ReturnOrder input)
        {
            var workDto =_service.AddReturnOrder(input);
            return Ok(workDto);
        }

        /// <summary>
        /// 删除退回订单
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult DeletReturnOrder(int id)
        {
            var returnOrder =_service.DeletReturnOrder(id);
            return Ok(returnOrder);
        }

        /// <summary>
        /// 根据id获取退回订单
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public IActionResult GetReturnOrder(int id)
        {
            var works = _service.GetReturnOrder(id);
            return Ok(works);
        }

        /// <summary>
        /// 更新退回订单
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult UpdateReturnOrder(UpdateReturnOrderDto input)
        {
            var wang = _service.UpdateReturnOrder(input);
            return Ok(wang);
        }
    }
}
